//快速排序

function quicksort(nums:number[]):number[]{
    if(nums.length <= 1){
        return nums
    }
    let basicpoint = Math.floor(nums.length/2)
    let left:number[] = []
    let right:number[] = []
    for(let i = 0;i<nums.length;i++){
        if(i == basicpoint) continue
        if(nums[i] >= nums[basicpoint]){
           
            right.push(nums[i])
        }
        if(nums[i] < nums[basicpoint]){
            left.push(nums[i])
        }
    }
    console.log(left,right)
    return [...quicksort(left),nums[basicpoint],...quicksort(right)]
}

console.log(quicksort([5,1,1,2,0,0]))